import request from '@/utils/request'
import {
  data
} from '../../libs/mixin/template_page_mixin'

// 添加试题
export function addPaper(data) {
  return request({
    url: '/admin/exam/paper/edit',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

//获取公共题库
export function getExamAPI(data) {
  return request({
    url: '/app/practice/question-bank/get',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

//获取试题
export function getPaperAPI(data) {
  return request({
    url: '/practice/question/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}

//获得试卷进度记录
export function startRecitePaperAPI(data) {
  return request({
    url: '/app/practice/exam-paper-progress-record/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}
//更新试卷进度记录
export function updateRecitePaperAPI(data) {
  return request({
    url: '/app/practice/exam-paper-progress-record/update',
    headers: {
      isToken: true
    },
    'method': 'PUT',
    'data': data
  })
}
//删除试卷进度记录
export function deleteRecitePaperAPI(data) {
  return request({
    url: '/app/practice/exam-paper-progress-record/delete?id=' + data,
    headers: {
      isToken: true
    },
    'method': 'DELETE',
  })
}

//导入题库
export function exportPaperAPI(data) {
  return request({
    url: '/practice/question/import',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

// 个体题库
export function getPersonPaperAPI(data) {
  return request({
    url: '/app/practice/question-bank/private/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}

//获得私人题库分页
export function getPersonPaperListAPI(data) {
  return request({
    url: '/app/practice/question-bank/page',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': {
      ...data,
      privated: true
    }
  })
}
//获得公共题库
export function getPublicPaperListAPI(data) {
	return request({
		url: '/app/practice/question-bank/page',
		headers: {
			isToken: true
		},
		'method': 'GET',
    'data': {
      ...data,
      privated: false
    }
  })
}

//获得私人题库
export function getPersonPaperDetailAPI(data) {
  return request({
    url: '/app/practice/question-bank/private/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}

//获得错题分页
export function getErrorPaperAPI(data) {
  return request({
    url: '/app/practice/question-wrong/get?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',
  })
}
//获得错题
export function getErrorPaperListAPI(data) {
  return request({
    url: '/app/practice/question-wrong/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}
//删除全部错题
export function deleteErrorPaperAPI(data) {
  return request({
    url: '/app/practice/question-wrong/delete/all?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'DELETE',
  })
}

//获得所有错题
export function getErrorPaperAllAPI(data) {
  return request({
    url: '/app/practice/question-wrong/page/all',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}

//获得收藏分页
export function getCollectPaperAllAPI(data) {
  return request({
    url: '/app/practice/question-collect/page',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}
//获得今日错题
export function getTodayErrorAPI(data) {
  return request({
    url: '/app/practice/question-wrong/page/today',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}
//提交
export function submitAPI(data) {
  return request({
    url: '/app/practice/exam-paper-answer/submit',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

//导入题库
export function importPaperAPI(data) {
  return request({
    url: '/app/practice/question-bank/import',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

//获得AI联想词
export function queryAIAssociateAPI(data) {
  return request({
    url: '/app/practice/ai-answer/queryAIAssociate',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}
//获得App首页信息
export function indexAPI() {
  return request({
    url: '/app/dashboard/get/index',
    headers: {
      isToken: true
    },
    'method': 'GET',
  })
}

//获取公共题库详情
export function getPublicByIdAPI(data) {
  return request({
    url: '/practice/exam-paper/get',
    headers: {
      isToken: true
    },
    'method': 'GET',
    'data': data
  })
}

//重新刷题e
export function resetByIdAPI(data) {
  return request({
    url: '/app/practice/question-bank/reset',
    headers: {
      isToken: true
    },
    'method': 'DELETE',
    'data': data
  })
}
//删除私人题库
export function deletePersonAPI(data) {
  return request({
    url: '/app/practice/question-bank/delete?id=' + data,
    headers: {
      isToken: true
    },
    'method': 'DELETE',
  })
}
//更新题库
export function putPersonAPI(data) {
  return request({
    url: '/app/practice/question-bank/update',
    headers: {
      isToken: true
    },
    'method': 'PUT',
    'data': data
  })
}

//下载模版
export function downPersonExcelAPI(data) {
  return request({
    url: '/app/practice/question-bank/get-import-template?templateId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',

  })
}

//获得收藏

export function getCollectAPI(data) {
  return request({
    url: '/app/practice/question-collect/get?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',

  })
}

//获得所有收藏
export function getCollectAllAPI(data) {
  return request({
    url: '/app/practice/question-collect/list/all?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',

  })
}
//今日收藏
export function getCollectTodayAPI(data) {
  return request({
    url: '/app/practice/question-collect/list/today?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',

  })
}
//获得收藏题库
export function getCollectPaperAPI(data) {
  return request({
    url: '/app/practice/question-collect/get?examPaperId=' + data,
    headers: {
      isToken: true
    },
    'method': 'GET',
    headers: {
      isToken: true
    },
    'method': 'GET',

  })
}

//收藏题库
export function collectAPI(data) {
  return request({
    url: '/app/practice/question-collect/create',
    headers: {
      isToken: true
    },
    'method': 'POST',
    'data': data
  })
}

//取消收藏 
export function deleteCollectAPI(data) {
  return request({
    url: '/app/practice/question-collect/delete?examPaperId=' + data.examPaperId + '&questionId=' + data.questionId,
    headers: {
      isToken: true
    },
    'method': 'DELETE',
  })
}
//置顶
export function pinToTopAPI(data) {
  return request({
    url: '/app/practice/question-bank/sticky',
    headers: {
      isToken: true
    },
    'method': 'PUT',
    'data': data
  })
}

export function createNote(data) {
  return request({
    url: '/app/practice/question-remark/create',
    headers: {
      isToken: true
    },
    method: 'POST',
    data
  })
}
export function updateNote(data) {
  return request({
    url: '/app/practice/question-remark/update',
    headers: {
      isToken: true
    },
    method: 'PUT',
    data
  })
}
export function deletetNote(data) {
  return request({
    url: '/app/practice/question-remark/delete',
    headers: {
      isToken: true
    },
    method: 'DELETE',
    data
  })
}
export function getNote(data) {
  return request({
    url: '/app/practice/question-remark/get',
    headers: {
      isToken: true
    },
    method: 'GET',
    data
  })
}
export function getNotePage(data) {
  return request({
    url: '/app/practice/question-remark/page',
    headers: {
      isToken: true
    },
    method: 'GET',
    data
  })
}



